#pragma once
// -------------------------------------------------
// ZED Kit
// -------------------------------------------------
//   File Name: core_graphics.hpp
//      Author: Ziming Li
//     Created: 2023-11-13
// -------------------------------------------------
// Copyright (C) 2023 MingYang Software Technology.
// -------------------------------------------------

#ifndef ZED_APPLE_CORE_GRAPHICS_HPP
#define ZED_APPLE_CORE_GRAPHICS_HPP

#include <CoreGraphics/CoreGraphics.h>
#include "./core_foundation.hpp"

namespace zed {

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Implementations

template <>
struct cf_release_trait<CGColorSpaceRef> {
    static void release(CGColorSpaceRef colorSpace) { ::CGColorSpaceRelease(colorSpace); }
};

template <>
struct cf_release_trait<CGContextRef> {
    static void release(CGContextRef context) { ::CGContextRelease(context); }
};

template <>
struct cf_release_trait<CGDataProviderRef> {
    static void release(CGDataProviderRef dataProvider) { ::CGDataProviderRelease(dataProvider); }
};

template <>
struct cf_release_trait<CGFontRef> {
    static void release(CGFontRef font) { ::CGFontRelease(font); }
};

template <>
struct cf_release_trait<CGImageRef> {
    static void release(CGImageRef image) { ::CGImageRelease(image); }
};

template <>
struct cf_release_trait<CGMutablePathRef> {
    static void release(CGMutablePathRef path) { ::CGPathRelease(path); }
};

template <>
struct cf_release_trait<CGPathRef> {
    static void release(CGPathRef path) { ::CGPathRelease(path); }
};

} // namespace zed

#endif // ZED_APPLE_CORE_GRAPHICS_HPP
